Add topousa4/xmap format.
authorrobertl <robertl@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Sun, 6 Oct 2002 02:47:53 +0000 (02:47 +0000)
committerrobertl <robertl@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Sun, 6 Oct 2002 02:47:53 +0000 (02:47 +0000)
gpsbabel/README
gpsbabel/csv.c
gpsbabel/reference/xmap [new file with mode: 0644]
gpsbabel/testo
gpsbabel/vecs.c

index e222bd5a1147b8edb3ef2de545802f37ed358cbf..f6bcbbfffd821dedb3ead81b563bed2d30046421 100644 (file)
@@ -87,6 +87,14 @@ THE FORMATS
        There are a billion variants of Comma Separated Value data.  This
        is the one that makes Delorme S&A Deluxe 9 happy.
 
+    XMap 
+
+       Delorme TopoUSA/XMap Conduit is one of the billion CSV variants 
+       mentioned above.  It's just like S&A with the addition of a 
+       completely pointless line at the beginning and end of the file.   
+       This is the format used to hot-sync to XMap from withing TopoUSA.
+       Done with help of Dan Edwards.
+
     MAPSEND
 
        Magellan was smart enough to document their file format to make
index f7c70cd32801495539d8d2ace152154ee4c46c46..8f2df9dc9e1726de688e6c393e57efdebcac003a 100644 (file)
@@ -53,12 +53,27 @@ wr_init(const char *fname)
        }
 }
 
+static void
+xmap_wr_init(const char *fname)
+{
+       wr_init(fname);
+       fprintf(file_out, "BEGIN SYMBOL\n");
+}
+
+
 static void
 wr_deinit(void)
 {
        fclose(file_out);
 }
 
+static void
+xmap_wr_deinit(void)
+{
+       fprintf(file_out, "END\n");
+       wr_deinit();
+}
+
 static void
 data_read(void)
 {
@@ -107,9 +122,10 @@ data_read(void)
                wpt_tmp->creation_time = time(NULL);
                
                /* We'll make up our own shortname. */
-               wpt_tmp->shortname = mkshort(wpt_tmp->description);
-               
-               waypt_add(wpt_tmp);
+               if (wpt_tmp->description) {
+                       wpt_tmp->shortname = mkshort(wpt_tmp->description);
+                       waypt_add(wpt_tmp);
+               }
 
        } else {
                /* empty line */
@@ -154,3 +170,12 @@ ff_vecs_t csv_vecs = {
        data_read,
        data_write,
 };
+
+ff_vecs_t xmap_vecs = {
+       rd_init,
+       xmap_wr_init,
+       rd_deinit,
+       xmap_wr_deinit,
+       data_read,
+       data_write,
+};
diff --git a/gpsbabel/reference/xmap b/gpsbabel/reference/xmap
new file mode 100644 (file)
index 0000000..b5911f2
--- /dev/null
@@ -0,0 +1,4 @@
+BEGIN SYMBOL
+36.04768, -86.87918, Tennessee Scavenger Hunt Cache
+35.95765, -86.67185, Stonebrook-Greystone
+END
index cd5f5f874185e0599adb66544cad907a83e5dcef..004048717d6697e5d287281516313d57ed467bfb 100755 (executable)
@@ -53,9 +53,19 @@ diff ${TMPDIR}/tiger ${TMPDIR}/tiger2
 
 # CSV (Comma separated value) data.
 
-#${PNAME} -i geo -f geocaching.loc -o csv -F ${TMPDIR}/csv.csv
-#${PNAME} -i csv -f ${TMPDIR}/csv.csv -o gpsutil -F ${TMPDIR}/csv2.csv
-#diff ${TMPDIR}/csv2.csv ${TMPDIR}/gu.wpt
+${PNAME}  -i geo -f geocaching.loc -o csv -F ${TMPDIR}/csv.csv
+${PNAME}  -i csv -f ${TMPDIR}/csv.csv -o csv -F ${TMPDIR}/csv2.csv
+diff ${TMPDIR}/csv2.csv ${TMPDIR}/csv.csv 
+
+#
+# Delorme TopoUSA 4 is a CSV strain.  
+#
+rm -f ${TMPDIR}/xmap-1.gpx ${TMPDIR}/xmap-2.gpx ${TMPDIR}/xmap
+${PNAME} -i xmap -f reference/xmap -o xmap -F ${TMPDIR}/xmap
+${PNAME} -i xmap -f reference/xmap -o gpx -F ${TMPDIR}/xmap-1.gpx
+${PNAME} -i xmap -f ${TMPDIR}/xmap -o gpx -F ${TMPDIR}/xmap-2.gpx
+diff ${TMPDIR}/xmap-1.gpx ${TMPDIR}/xmap-2.gpx
+diff reference/xmap ${TMPDIR}/xmap
 
 # PCX (Garmin mapsource import) file format
 rm -f ${TMPDIR}/mm.pcx ${TMPDIR}/pcx.gps
@@ -96,3 +106,4 @@ diff ${TMPDIR}/ozi.ozi reference
 # identical reference.
 ${PNAME} -i holux -f reference/paris.wpo -o holux -F ${TMPDIR}/paris.wpo
 diff reference/paris.wpo ${TMPDIR}/paris.wpo
+
index 4cb72c8d5e83ea29373cc7c1ac881bae29c66132..db1e0691d97ddfbaa03f5a37d3257e772a033b69 100644 (file)
@@ -46,6 +46,7 @@ extern ff_vecs_t mxf_vecs;
 extern ff_vecs_t holux_vecs;
 extern ff_vecs_t ozi_vecs;
 extern ff_vecs_t dna_vecs;
+extern ff_vecs_t xmap_vecs;
 
 static
 vecs_t vec_list[] = {
@@ -99,6 +100,11 @@ vecs_t vec_list[] = {
                "csv",
                "Comma separated values"
        },
+       {
+               &xmap_vecs,
+               "xmap",
+               "Delorme Topo USA4/XMap Conduit"
+       },
        {
                &dna_vecs,
                "dna",